<h1>Listing services</h1>

<table>
  <tr>
    <th>id</th>
    <th>hostname</th>
    <th>description</th>
    <th>alerts</th>
  </tr>

<% @services.each do |service| %>
  <tr>
    <td><a href="<%= url_for(:controller=>"alerts", :action=>"index",:service_id=>service.id)%>"><%=h service.id%></a></td>
    <td><%=h service.hostname%></td>
    <td><%=h service.description%></td>
    <td><%=h service.alerts.size%></td>
  <% if logged? %>
    <td><%= link_to 'Show', service %></td>
    <td><%= link_to 'Edit', edit_service_path(service) %></td>
    <td><%= link_to 'Destroy', service, :confirm => 'Are you sure?', :method => :delete %></td>
  <% end %>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New service', new_service_path if logged? %>
